using System;

namespace OpenWaves.ActivityFeed.UnitTests
{
    public abstract class ActivityFeedServiceTestsBase
    {
        protected void Given(Action<IActivityFeedService> a)
        {
            using (var session = this.CreateSession())
            {
                a(session.CreateActivityFeedService());
                session.SaveChanges();
            }
        }

        protected void When(Action<IActivityFeedService> a)
        {
            using (var session = this.CreateSession())
            {
                a(session.CreateActivityFeedService());
                session.SaveChanges();
            }
        }

        protected void Then(Action<IActivityFeedService> action)
        {
            using (var session = this.CreateSession())
            {
                action(session.CreateActivityFeedService());
                session.SaveChanges();
            }
        }

        protected abstract IActivityFeedTestSession CreateSession();        
    }
}